<!DOCTYPE html>
<html lang="zh">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/header :: header(~{::title},~{::link},~{})">
    <title>点餐</title>
    <link rel="icon" th:href="@{/assets/img/lcxm.ico}" type="image/ico">
</head>
<body class="body">
<!--导航-->
<div th:replace="common/nav :: nav(true)"></div>

<div class="container">

    <div class="row">
        <div style="margin-top: 20px;"></div>
        <div class="row">

            <form class="form-horizontal validate" role="form" method="post" th:action="@{/project/save}"
                  onsubmit="return checkForm(this);">

                <!-- 操作信息提示的地方 -->
                <div th:if="${remind}" class="alert alert-${ remind.level  }"
                     th:classappend="'alert-' + ${remind.level}">
                    <button data-dismiss="alert" class="close" type="button">
                        <i class="glyphicon glyphicon-remove"></i>
                    </button>
                    <span th:remove="tag" th:utext="${ remind.message }"></span>
                </div>

                <div class="col-sm-12 col-sm-offset-0">
                    <div class="action-bar">
                        <a class="btn btn-sm btn-primary" id="addRow" title="新增工时" data-toggle="tooltip">
                            <i class="glyphicon glyphicon-plus"></i> 新增一行
                        </a>
                    </div>

                    <table class="table table-striped  table-hover table-bordered stable">
                        <colgroup>
                            <col style="width: 15%;">
                            <col style="width: 15%;">
                            <col style="width: 15%;">
                            <col style="width: 15%;">
                            <col style="width: 35%;">
                            <col style="width: 5%;">
                        </colgroup>
                        <thead>
                        <tr class="text-center">
                            <th>项目</th>
                            <th>日期</th>
                            <th>JIRA</th>
                            <th>工时(分钟)</th>
                            <th>内容</th>
                            <th class="text-info">操作</th>
                        </tr>
                        </thead>
                        <tbody align="center" id="tbody">
                        <!-- </c:forEach> -->

                        </tbody>
                    </table>
                </div>

                <div class="form-group">
                    <div class="col-sm-12">
                        <div class="alert alert-info">
                            <strong>当前页面已填报总工时: <span id="totalTimes" class="text-danger">0</span> 分钟</strong>
                        </div>
                        <div class="alert alert-warning alert-dismissable">
                            <button type="button" class="close" data-dismiss="alert" id="notify"
                                    aria-hidden="true">
                                &times;
                            </button>
                            <strong>注意填写正确的jira号，工银与非工银的jira数据库分离，工银的jira前缀为<span class="text-primary">ICBCSTL</span>，查工银库，否则为非工银jira，查非工银库。</strong>
                        </div>
                    </div>
                </div>


                <div class="form-group clearfix">
                    <div class="col-sm-offset-4 col-sm-8">
                        <button th:if="${remind == null}" type="button" onclick="submitBatch(this);" class="btn btn-lg btn-primary">
                            <i class="glyphicon glyphicon-ok"></i> 提交
                        </button>
                        <a type="button" class="btn btn-lg  btn-info" id="backBtn" th:href="@{/report/}">
                            <i class="glyphicon glyphicon-repeat"></i> 返回
                        </a>
                    </div>
                </div>


            </form>

        </div>
    </div>
</div>

<table style="display: none;">
    <tr id="templateTr">
        <td>
            <select class="form-control" name="projectId"
                    data-width="15em"
                    style="max-width: 15em;"
                    data-allow-clear="true"
                    onChange="fillRowJiraPrefix(this)"
                    data-rule-required="true">
                <option value="">选择所属项目</option>
                <option th:each="item:${projects}" th:value="${item.id}"
                        th:text="${item.text + ' (' + item.pid+')'}"
                        th:attr="data-jira-prefix=${item.pid}"></option>
            </select>
        </td>
        <td>
            <input class="datetime form-control input-sm" name="date" type="text"
                   th:value="${today}"
                   data-picker-position="bottom-right"
                   data-date-format="yyyy-mm-dd" data-min-view="2"
                   data-end-date-target="now"
                   readonly placeholder="日期"/>
        </td>
        <td>
            <input type="text" class="form-control" name="jira" value=""
                   onBlur="checkRowJiraPrefix(this)"
                   onclick="checkRowProject(this)"
                   placeholder="注意和项目的jira前缀保持一致" autocomplete="off"/>
        </td>
        <td>
            <input type="number" class="form-control" name="duration"
                   onblur="summaryTotalTimes(this);"
                   placeholder="单位:分" autocomplete="off"/>
        </td>
        <td>
            <textarea class="form-control" name="content" data-rule-required="true"
                      placeholder="工作内容, 包括完成度" autocomplete="off" rows="2"></textarea>
        </td>
        <td class="text-info">
            <button class="btn btn-xs btn-danger" type="button"
                    onclick="delRowReport(this)"
                    data-toggle="tooltip"
                    title="删除新增">
                <i class="glyphicon glyphicon-trash"></i>
            </button>
        </td>
    </tr>
</table>

<!-- 引入通用js-->
<div th:replace="common/footer :: footer"></div>
<script th:src="@{/js/report/report.js}"></script>
<script>
    // 使用jQuery选择器获取按钮元素
    $('#notify').delay(5000).queue(function() {
        // 触发按钮的点击事件
        $(this).click();
        // 完成队列操作，可省略，一般用于更复杂的队列操作场景
        $(this).dequeue();
    });

</script>

</body>
</html>